package com.yykj.hospital.server.model.entity;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.yykj.common.util.serializer.LocalDate2LongSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.UpdateTimestamp;

import javax.persistence.Entity;
import javax.persistence.Id;
import java.time.LocalDateTime;

@Data
@Entity
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class HospitalSettingOnlineOther {
    @Id
    @ApiModelProperty("医院ID")
    private Integer hospitalId;

    @ApiModelProperty("取消预约次数限制")
    private Integer cnt1 ;

    @ApiModelProperty("最晚取消预约时间")
    private Integer cnt2;

    @ApiModelProperty("可预约最长时间")
    private Integer cnt3;

    @JsonSerialize(using = LocalDate2LongSerializer.class)
    @CreationTimestamp
    private LocalDateTime addTime;

    @JsonSerialize(using = LocalDate2LongSerializer.class)
    @UpdateTimestamp
    private LocalDateTime modifyTime;

    public static HospitalSettingOnlineOther defaultHospitalSettingOnlineOther(Integer hospitalId) {
        return HospitalSettingOnlineOther.builder()
                .hospitalId(hospitalId)
                .cnt1(3)
                .cnt2(24)
                .cnt3(30)
                .build();
    }

}
